package com.rslai.base.tool.servertest.objectfactory;

import java.lang.reflect.Type;

public class BooleanFactory extends InstanceFactory {
    protected Object create(Type type, Object value) {
        if (value == null) {
            return type.equals(Boolean.TYPE) ? Boolean.valueOf(false) : null;
        }
        return Boolean.valueOf(value.toString());
    }

    protected boolean support(Type type) {
        return (type.equals(Boolean.class)) || (type.equals(Boolean.TYPE));
    }
}
